home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 12 / BBS in a box XII-2.iso / Files II / MacTechNotes / Platforms & Tools / Stand-Alone Code.sit / CWDEFƒ / MyWindowDef.c / MyWindowDef.c
Encoding:
C/C++ Source or Header  |  1990-07-24  |  2.6 KB  |  100 lines  |  [TEXT/MPS ]

  1.     /* first, the mandatory includes */
  2.     #include <types.h>
  3.     #include <quickdraw.h>
  4.     #include <resources.h>
  5.     #include <fonts.h>
  6.     #include <windows.h>
  7.     #include <menus.h>
  8.     #include <textedit.h>
  9.     #include <events.h>
  10.  
  11.     /* declarations */
  12.     void DoDrawSize();
  13.     void DoGrow();
  14.     void DoCalcRgns();
  15.     long int DoHit();
  16.     void DoDraw();
  17.  
  18.     /*---------------------- Main Proc within WDEF ----------------------*/
  19.     pascal long int MyWindowDef(varCode,theWindow,message,param)
  20.     short int     varCode;
  21.     WindowPtr     theWindow;
  22.     short int     message;
  23.     long int     param;
  24.  
  25.     {     /* MyWindowDef */
  26.  
  27.       Rect         *aRectPtr;
  28.       long int     theResult=0;        /*this is what the function returns, init to 0 */
  29.  
  30.       switch (message)
  31.       {
  32.         case wDraw:                 /* draw window frame*/
  33.           DoDraw(theWindow,param);
  34.           break;
  35.         case wHit:                    /* tell what region the mouse was pressed in*/
  36.           theResult = DoHit(theWindow,param);
  37.           break;
  38.         case wCalcRgns:             /* calculate structRgn and contRgn*/
  39.           DoCalcRgns(theWindow);
  40.           break;
  41.         case wNew:                    /* do any additional initialization*/
  42.           break;                    /* nothing here */
  43.         case wDispose:                /* do any additional disposal actions*/
  44.           break;                    /* we don't need to do any*/
  45.         case wGrow:                 /* draw window's grow image*/
  46.           aRectPtr = (Rect *)param;
  47.           DoGrow(theWindow,*aRectPtr);
  48.           break;
  49.         case wDrawGIcon:            /* draw Size box in content region*/
  50.           DoDrawSize(theWindow);
  51.           break;
  52.       }  /* switch */
  53.       return theResult;
  54.     }     /* MyWindowDef */
  55.  
  56.     /* here are the routines that are dispatched to by MyWindowDef */
  57.  
  58.     /*--------------------------- DoDraw function -----------------------------*/
  59.     void DoDraw(WindToDraw,DrawParam)
  60.     WindowPtr     WindToDraw;
  61.     long int     DrawParam;
  62.  
  63.     {  /* DoDraw */
  64.           /* code for DoDraw goes here */
  65.     }  /* DoDraw */
  66.  
  67.     /*--------------------------- DoHit function -----------------------------*/
  68.     long int DoHit(WindToTest,theParam)
  69.     WindowPtr     WindToTest;
  70.     long int     theParam;
  71.  
  72.     {  /* DoHit */
  73.           /* code for DoHit goes here */
  74.     }  /* DoHit */
  75.  
  76.     /*------------------------ DoCalcRgns procedure --------------------------*/
  77.     void DoCalcRgns(WindToCalc)
  78.     WindowPtr     WindToCalc;
  79.  
  80.     {  /* DoCalcRgns */
  81.           /* code for DoCalcRgns goes here */
  82.     }  /* DoCalcRgns */
  83.  
  84.     /*-------------------------- DoGrow procedure ----------------------------*/
  85.     void DoGrow(WindToGrow,theGrowRect)
  86.     WindowPtr     WindToGrow;
  87.     Rect         theGrowRect;
  88.  
  89.     {  /* DoGrow */
  90.           /* code for DoGrow goes here */
  91.     }  /* DoGrow */
  92.  
  93.     /*------------------------ DoDrawSize procedure --------------------------*/
  94.     void DoDrawSize(WindToDraw)
  95.     WindowPtr     WindToDraw;
  96.  
  97.     {  /* DoDrawSize */
  98.           /* code for DoDrawSize goes here */
  99.     }  /* DoDrawSize */
  100.